/*
 * @Author: szx
 * @Date: 2022-02-25 14:26:10
 * @LastEditTime: 2022-02-25 14:28:46
 * @Description:
 * @FilePath: \leetcode\1-99\1\1_2.js
 */
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function (nums, target) {
    const map = new Map();
    for (let i = 0; i < nums.length; i++) {
        map.set(nums[i], i);
        if (map.get(target - i)) return [map.get(target - i), i];
    }
    return [0, 0];
};
